<input type="text">
<ul></ul>


<script src="./ajax.js"></script>
<script>
    
    document.querySelector('input').oninput = function(){
        get('http://www.baidu.com/sugrec',
        {
            prod: 'pc',
            wd: this.value
            
        },
        res =>{
            document.querySelector('ul').innerText = ''
            if(!res.g) return
            res.g.forEach((item,i) => {
                let liObj = document.createElement('li')
                liObj.innerText = item.q
                document.querySelector('ul').appendChild(liObj)
            })
        },'json')
    }
</script>